package com.cn.encryp;

import java.util.Base64;

public class Base64Utils {

    public static String encode(String src) {
        byte[] encode = Base64.getEncoder().encode(src.getBytes());
        return new String(encode);
    }

    public static String decode(String src) {
        byte[] decodeBytes = Base64.getDecoder().decode(src);
        return new String(decodeBytes);
    }

    public static void main(String[] args) {
        String s= "hello world";
        String encode = encode(s);
        System.out.println(encode(encode));
        System.out.println(decode(encode));
    }
}
